import http from "@/utils/http";
import { AxiosRequestConfig } from "axios";

export interface DeleteDataTableDelDimTableById_ {
  /**
   * @description id
   */
  id: number;
}
export interface DeleteDataTableDelDimTableForKeyById_ {
  /**
   * @description id
   */
  id: number;
}
export interface DeleteDataTableDeleteById_ {
  /**
   * @description id
   */
  id: number;
}
export interface GetDataTableForeignQueryById_ {
  /**
   * @description id
   */
  id: number;
}
export interface GetDataTableGetById_ {
  /**
   * @description id
   */
  id: number;
}
export interface GetDataTableGetDimensionEnumById_ {
  /**
   * @description id
   */
  id: number;
}
export interface GetDataTableGetDimensionIdAndName_ {
  /**
   * @description dimensionName
   */
  dimensionName?: string;
}
export interface GetDataTableGetForeignKeyTreeById_ {
  /**
   * @description id
   */
  id: number;
}
export interface GetDataTableGetTableFieldById_ {
  /**
   * @description id
   */
  id: number;
}
export interface GetDataTableGetTableNameAndId_ {
  /**
   * @description tableName
   */
  tableName?: string;
}
export interface GetDataTableTableFieldRelationQueryById_ {
  /**
   * @description id
   */
  id: number;
}
export interface DeleteDataTableUnboundDimTableById_ {
  /**
   * @description id
   */
  id: number;
}

export class DataTable {
  /**
   * 添加/修改维表关联(单个)
   *
   * @tags 数据表-管理
   * @request POST: /dataTable/addOrUpdateFieldRelation
   * @secure
   */
  postDataTableAddOrUpdateFieldRelation = (dto: defs.DataFieldRelationDto, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityObject>({
      url: `/dataTable/addOrUpdateFieldRelation`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 新增数据表
   *
   * @tags 数据表-管理
   * @request POST: /dataTable/addTable
   * @secure
   */
  postDataTableAddTable = (dto: defs.DataTableDto, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityDataTableDto>({
      url: `/dataTable/addTable`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 切换数据集成方式
   *
   * @tags 数据表-管理
   * @request POST: /dataTable/changeDataBuildType
   * @secure
   */
  postDataTableChangeDataBuildType = (dto: defs.DataTableDto, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityObject>({
      url: `/dataTable/changeDataBuildType`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 维表删除
   *
   * @tags 数据表-管理
   * @request DELETE: /dataTable/delDimTable/{id}
   * @secure
   */
  deleteDataTableDelDimTableById = (
    { id }: { id: number } | DeleteDataTableDelDimTableById_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityObject>({
      url: `/dataTable/delDimTable/${id}`,
      method: "DELETE",
      ...params,
    });

  /**
   * 维表外键关联删除
   *
   * @tags 数据表-管理
   * @request DELETE: /dataTable/delDimTableForKey/{id}
   * @secure
   */
  deleteDataTableDelDimTableForKeyById = (
    { id }: { id: number } | DeleteDataTableDelDimTableForKeyById_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityObject>({
      url: `/dataTable/delDimTableForKey/${id}`,
      method: "DELETE",
      ...params,
    });

  /**
   * 删除数据表
   *
   * @tags 数据表-管理
   * @request DELETE: /dataTable/delete/{id}
   * @secure
   */
  deleteDataTableDeleteById = ({ id }: { id: number } | DeleteDataTableDeleteById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityObject>({
      url: `/dataTable/delete/${id}`,
      method: "DELETE",
      ...params,
    });

  /**
   * 维表操作日志查询-分页
   *
   * @tags 数据表-管理
   * @request POST: /dataTable/fieldLog/pageQuery
   * @secure
   */
  postDataTableFieldLogPageQuery = (dto: defs.TableFieldRelationQueryDto, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityPageInfoTableFieldRelationLogVo>({
      url: `/dataTable/fieldLog/pageQuery`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 根据表id获取表字段信息列表 -分页
   *
   * @tags 数据表-管理
   * @request POST: /dataTable/fieldPage
   * @secure
   */
  postDataTableFieldPage = (dto: defs.TableFieldPageQueryDto, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityPageInfoTableFieldVo>({
      url: `/dataTable/fieldPage`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 维表外键关联关系查询
   *
   * @tags 数据表-管理
   * @request GET: /dataTable/foreignQuery/{id}
   * @secure
   */
  getDataTableForeignQueryById = (
    { id }: { id: number } | GetDataTableForeignQueryById_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityDimForeignKeyRelationVo>({
      url: `/dataTable/foreignQuery/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 根据id数据表详情
   *
   * @tags 数据表-管理
   * @request GET: /dataTable/get/{id}
   * @secure
   */
  getDataTableGetById = ({ id }: { id: number } | GetDataTableGetById_, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityDataTableVo>({
      url: `/dataTable/get/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 获取表数据记录-分页
   *
   * @tags 数据表-管理
   * @request POST: /dataTable/getDataTableRecord
   * @secure
   */
  postDataTableGetDataTableRecord = (dto: defs.DataTableRecordQueryDto, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityDataTableRecordVo>({
      url: `/dataTable/getDataTableRecord`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 维表列表查询-分页
   *
   * @tags 数据表-管理
   * @request POST: /dataTable/getDimTablePage
   * @secure
   */
  postDataTableGetDimTablePage = (dto: defs.DimTableQueryDto, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityPageInfoDataTableVo>({
      url: `/dataTable/getDimTablePage`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 获取维度枚举列表
   *
   * @tags 数据表-管理
   * @request GET: /dataTable/getDimensionEnum/{id}
   * @secure
   */
  getDataTableGetDimensionEnumById = (
    { id }: { id: number } | GetDataTableGetDimensionEnumById_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityListMapStringString>({
      url: `/dataTable/getDimensionEnum/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 获取绑定了维表的维度
   *
   * @tags 数据表-管理
   * @request GET: /dataTable/getDimensionIdAndName
   * @secure
   */
  getDataTableGetDimensionIdAndName = (
    query: { dimensionName?: string } | GetDataTableGetDimensionIdAndName_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityListOptionVO>({
      url: `/dataTable/getDimensionIdAndName`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 维表外键关联关系树形结构查询
   *
   * @tags 数据表-管理
   * @request GET: /dataTable/getForeignKeyTree/{id}
   * @secure
   */
  getDataTableGetForeignKeyTreeById = (
    { id }: { id: number } | GetDataTableGetForeignKeyTreeById_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityTableForeignKeyRelationVo>({
      url: `/dataTable/getForeignKeyTree/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 根据表id获取表字段信息列表-非分页
   *
   * @tags 数据表-管理
   * @request GET: /dataTable/getTableField/{id}
   * @secure
   */
  getDataTableGetTableFieldById = (
    { id }: { id: number } | GetDataTableGetTableFieldById_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityListTableFieldVo>({
      url: `/dataTable/getTableField/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 数据表列表查询
   *
   * @tags 数据表-管理
   * @request POST: /dataTable/getTableList
   * @secure
   */
  postDataTableGetTableList = (dto: defs.DimTableQueryDto, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityListDataTableVo>({
      url: `/dataTable/getTableList`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 获取表id和表名称
   *
   * @tags 数据表-管理
   * @request GET: /dataTable/getTableNameAndId
   * @secure
   */
  getDataTableGetTableNameAndId = (
    query: { tableName?: string } | GetDataTableGetTableNameAndId_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityListOptionVO>({
      url: `/dataTable/getTableNameAndId`,
      method: "GET",
      params: query,
      ...params,
    });

  /**
   * 数据表查询-分页
   *
   * @tags 数据表-管理
   * @request POST: /dataTable/pageQuery
   * @secure
   */
  postDataTablePageQuery = (dto: defs.DataTablePageQueryDto, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityPageInfoDataTablePageVo>({
      url: `/dataTable/pageQuery`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 维表设置
   *
   * @tags 数据表-管理
   * @request POST: /dataTable/setDimTableBind
   * @secure
   */
  postDataTableSetDimTableBind = (dto: defs.DimTableBindDto, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityObject>({
      url: `/dataTable/setDimTableBind`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 维表外键关联设置
   *
   * @tags 数据表-管理
   * @request POST: /dataTable/setDimTableForKeyBind
   * @secure
   */
  postDataTableSetDimTableForKeyBind = (dto: defs.DimTableForeignKeyBindDto, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityObject>({
      url: `/dataTable/setDimTableForKeyBind`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 维表详情关联维度关系查询
   *
   * @tags 数据表-管理
   * @request GET: /dataTable/tableFieldRelationQuery/{id}
   * @secure
   */
  getDataTableTableFieldRelationQueryById = (
    { id }: { id: number } | GetDataTableTableFieldRelationQueryById_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityDimTableFieldRelationVo>({
      url: `/dataTable/tableFieldRelationQuery/${id}`,
      method: "GET",
      ...params,
    });

  /**
   * 解绑维表关联
   *
   * @tags 数据表-管理
   * @request DELETE: /dataTable/unboundDimTable/{id}
   * @secure
   */
  deleteDataTableUnboundDimTableById = (
    { id }: { id: number } | DeleteDataTableUnboundDimTableById_,
    params: AxiosRequestConfig = {},
  ) =>
    http.request<defs.ResponseEntityObject>({
      url: `/dataTable/unboundDimTable/${id}`,
      method: "DELETE",
      ...params,
    });

  /**
   * 修改维表描述
   *
   * @tags 数据表-管理
   * @request POST: /dataTable/updateDimTableDesc
   * @secure
   */
  postDataTableUpdateDimTableDesc = (dto: defs.DimTableBindDto, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityObject>({
      url: `/dataTable/updateDimTableDesc`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 更新数据表
   *
   * @tags 数据表-管理
   * @request POST: /dataTable/updateTable
   * @secure
   */
  postDataTableUpdateTable = (dto: defs.DataTableDto, params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityDataTableDto>({
      url: `/dataTable/updateTable`,
      method: "POST",
      data: dto,
      ...params,
    });

  /**
   * 维表详情关联维度关系查询
   *
   * @tags 数据表-管理
   * @request GET: /sync/table
   * @secure
   */
  getSyncTable = (params: AxiosRequestConfig = {}) =>
    http.request<defs.ResponseEntityObject>({
      url: `/sync/table`,
      method: "GET",
      ...params,
    });
}

export default new DataTable();
